<template>
	<view style="padding: 30rpx;align-items: center;text-align: center;">
		<view style="width: 600rpx;margin-left: 120rpx;">
			<u-radio-group v-model="value" @change="radioGroupChange" width="300rpx" active-color="#EA5344">
				<u-radio @change="radioChange" v-for="(item, index) in list" :key="index" :name="item.name"
					:disabled="item.disabled">
					{{item.name}}
				</u-radio>
			</u-radio-group>
		</view>
		<view style="margin-top: 30rpx;">
			<u-input v-model="values" type="textarea" :border="true" :placeholder="placeholder" height="300" maxlength="200"/>
		</view>
		<view style="margin-top: 30rpx;">
			<u-button hover-class="none" v-if="values !== ''" :custom-style="{'backgroundColor':'#EA5344','color':'#FFFFFF'}"  style="width: 80%;" shape="circle" @click="upfk()">提交</u-button>
			<u-button hover-class="none" v-if="values === ''" :custom-style="{'backgroundColor':'#e5e5e5','color':'#000000'}" style="width: 80%;" shape="circle" :disabled="true" :hair-line="false">提交</u-button>
			
		</view>
	</view>
</template>

<script>
	import Config from '../../common/config.js';
	export default {
		data() {
			return {
				placeholder:"请输入反馈建议，我们将不断改进",
				values:"",
				list: [{
						name: '产品建议',
						disabled: false
					},
					{
						name: '程序错误',
						disabled: false
					}
				],
				value: '产品建议',
			}
		},
		methods: {
			upfk(){
				let that =this;
				let types = 0
				if(that.value === "产品建议"){
					types = 0
				}else{
					types = 1
				}
				uni.request({
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					url:"https://psl.benyiit.com/api/pslapi/insertfk",
					method:"POST",
					data:{
						phone:Config.phone,
						content:that.values,
						fk_type:types
					},
					complete: () => {
						uni.showToast({
							title: '已提交',
							icon: 'none'
						})
						uni.navigateBack({
						    delta: 1
						});
					}
					
				})
			},
			// 选中某个单选框时，由radio时触发
			radioChange(e) {
				// console.log(e);
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				// console.log(e);
			}
		}
	}
</script>

<style>

</style>
